<?php

namespace Biz\module\Behaviors\Stock;

use Biz\cache\Stock;
use Biz\cache\Stock as cStock;
use Biz\model\GoodsSku as mGoodsSku;
use Biz\model\GoodsStockLog;

class GoodsSkuStock extends StockBehaviorsAbstruct
{


    const TYPE_LOG = GoodsStockLog::TYPE_NORMAL_GOODS;


    public static function setStocksCache($goods_ids)
    {
        $skuInfos = mGoodsSku::getSkuInfo($goods_ids, false);

        foreach ($skuInfos as $goods_id => $skuList) {
            cStock::setMultiStock($goods_id, array_column($skuList, "stock", "id"));
        }

    }

    public static function updateDbStock($stockInfo)
    {

        mGoodsSku::setMutiStocks($stockInfo);

    }

    public static function DecrStocksCounter($buyNums)
    {
        return Stock::DecrStocksCounter($buyNums);

    }

    public static function IncrStocksCounter($buyNums)
    {
        return Stock::IncrStocksCounter($buyNums);

    }
}